const HtmlWebpackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack").container
  .ModuleFederationPlugin;
const path = require("path");
const deps = require("./package.json").dependencies;
module.exports = {
  entry: "./src/index",
  mode: "none",
  devServer: {
    contentBase: path.join(__dirname, "dist"),
    port: 3001,
  },
  output: {
    publicPath: "auto",
  },
  module: {
    // rules: [
    //   {
    //     test: /\.jsx?$/,
    //     loader: "babel-loader",
    //     exclude: /node_modules/,
    //     options: {
    //       presets: ["@babel/preset-react"],
    //     },
    //   },
    // ],
  },
  plugins: [
    new ModuleFederationPlugin({
      name: "remoteAlbum",
      filename: "albumRemoteEntry.js",
      // remotes: {
      //   app2: "app2@http://localhost:3002/remoteEntry.js",
      // },
      exposes: {
        // "./Navigation": "./src/Navigation",
        // "./routes": "./src/routes",
        './say': './src/say'
      },
      // shared: {
      //   ...deps,
      //   react: {
      //     eager: true,
      //     singleton: true,
      //     requiredVersion: deps.react,
      //   },
      //   "react-dom": {
      //     eager: true,
      //     singleton: true,
      //     requiredVersion: deps["react-dom"],
      //   },
      // },
    }),
    new HtmlWebpackPlugin({
      template: "./public/index.html",
    }),
  ],
};
